<template>
  <div class="dashboard-container">
    <!-- 系统功能介绍 -->
    <el-card class="intro-card">
      <template #header>
        <div class="card-header">
          <span>高校教师学术成果信息综合管理系统</span>
        </div>
      </template>
      <div class="intro-content">
        <el-row :gutter="30">
          <el-col :xs="24" :sm="12" :md="6">
            <div class="feature-item">
              <div class="feature-icon">
                <el-icon size="40" color="#409EFF"><User /></el-icon>
              </div>
              <h3>学生管理</h3>
              <p>全面管理指导的研究生信息，包括学生基本资料、学习进度跟踪、学术表现评估等功能，实现师生关系的数字化管理。</p>
            </div>
          </el-col>
          <el-col :xs="24" :sm="12" :md="6">
            <div class="feature-item">
              <div class="feature-icon">
                <el-icon size="40" color="#67C23A"><Trophy /></el-icon>
              </div>
              <h3>成果管理</h3>
              <p>系统化管理学术成果，支持论文、专利、项目、获奖等多种成果类型的录入、分类、统计和展示，建立完整的成果档案。</p>
            </div>
          </el-col>
          <el-col :xs="24" :sm="12" :md="6">
            <div class="feature-item">
              <div class="feature-icon">
                <el-icon size="40" color="#E6A23C"><DocumentChecked /></el-icon>
              </div>
              <h3>审批流程</h3>
              <p>建立规范的成果审核机制，支持多级审批、评审意见记录、状态跟踪等功能，确保学术成果的质量和真实性。</p>
            </div>
          </el-col>
          <el-col :xs="24" :sm="12" :md="6">
            <div class="feature-item">
              <div class="feature-icon">
                <el-icon size="40" color="#F56C6C"><DataAnalysis /></el-icon>
              </div>
              <h3>数据分析</h3>
              <p>提供多维度的数据统计和分析功能，包括成果趋势分析、类型分布统计、绩效评估等，为学术决策提供数据支撑。</p>
            </div>
          </el-col>
        </el-row>
        
        <div class="system-description">
          <h3>系统特色</h3>
          <el-row :gutter="20">
            <el-col :span="12">
              <ul class="feature-list">
                <li><strong>一体化管理：</strong>集成学生信息、成果管理、审批流程于一体，实现全流程数字化管理</li>
                <li><strong>多角色支持：</strong>支持管理员、教师、学生三种角色，满足不同用户的功能需求</li>
                <li><strong>灵活审批：</strong>可配置的审批流程，支持多级审核和权限控制</li>
              </ul>
            </el-col>
            <el-col :span="12">
              <ul class="feature-list">
                <li><strong>数据安全：</strong>完善的权限控制和数据备份机制，确保学术数据安全</li>
                <li><strong>易于使用：</strong>简洁直观的用户界面，降低系统使用门槛</li>
                <li><strong>扩展性强：</strong>模块化设计，支持功能扩展和定制开发</li>
              </ul>
            </el-col>
          </el-row>
        </div>
      </div>
    </el-card>



    <el-card class="recent-card">
      <template #header>
        <div class="card-header">
          <span>待评审学术成果</span>
          <el-button type="primary" size="small" @click="$router.push('/teacher/approvals')">查看全部</el-button>
        </div>
      </template>
      <el-table v-loading="loading" :data="pendingApprovals" style="width: 100%">
        <el-table-column prop="title" label="成果名称" />
        <el-table-column prop="type" label="成果类型" width="100" />
        <el-table-column prop="studentName" label="申报人" width="120" />
        <el-table-column prop="createdAt" label="提交日期" width="180" />
        <el-table-column fixed="right" label="操作" width="150">
          <template #default="scope">
            <el-button link type="primary" @click="reviewAchievement(scope.row)">评审</el-button>
          </template>
        </el-table-column>
      </el-table>
    </el-card>
  </div>
</template>

<script lang="ts">
import { defineComponent, ref, onMounted } from 'vue'
import { ElMessage } from 'element-plus'
import { 
  User, 
  Trophy, 
  DocumentChecked, 
  DataAnalysis
} from '@element-plus/icons-vue'

interface PendingApproval {
  id: string
  title: string
  type: string
  studentName: string
  createdAt: string
}

interface Stats {
  students: number
  achievements: number
  pending: number
  newThisMonth: number
}

export default defineComponent({
  name: 'TeacherDashboard',
  components: {
    User,
    Trophy,
    DocumentChecked,
    DataAnalysis
  },
  setup() {
    const loading = ref(true)
    const pendingApprovals = ref<PendingApproval[]>([])
    const stats = ref<Stats>({
      students: 0,
      achievements: 0,
      pending: 0,
      newThisMonth: 0
    })

    const reviewAchievement = (achievement: PendingApproval) => {
      // 实际项目中会跳转到审核页面或打开审核对话框
      ElMessage.info(`正在审核: ${achievement.title}`)
    }

    onMounted(() => {
      // 模拟从API获取数据
      setTimeout(() => {
        stats.value = {
          students: 15,
          achievements: 48,
          pending: 7,
          newThisMonth: 12
        }

        pendingApprovals.value = [
          {
            id: '1',
            title: '基于深度学习的图像识别研究',
            type: '论文',
            studentName: '张同学',
            createdAt: '2023-06-20'
          },
          {
            id: '2',
            title: '智能家居控制系统设计',
            type: '专利',
            studentName: '王同学',
            createdAt: '2023-06-18'
          },
          {
            id: '3',
            title: '大数据分析在环境监测中的应用',
            type: '项目',
            studentName: '李同学',
            createdAt: '2023-06-15'
          }
        ]

        loading.value = false
      }, 1000)
    })

    return {
      loading,
      pendingApprovals,
      stats,
      reviewAchievement
    }
  }
})
</script>

<style scoped>
.dashboard-container {
  padding: 20px;
}

.intro-card {
  margin-bottom: 30px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 18px;
  font-weight: 600;
  color: #333;
}

.intro-content {
  padding: 20px 0;
}

.feature-item {
  text-align: center;
  padding: 20px;
  margin-bottom: 20px;
  border-radius: 8px;
  background: #fafbfc;
  transition: all 0.3s ease;
}

.feature-item:hover {
  background: #f0f9ff;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.feature-icon {
  margin-bottom: 15px;
}

.feature-item h3 {
  margin: 15px 0 10px 0;
  font-size: 18px;
  font-weight: 600;
  color: #333;
}

.feature-item p {
  color: #666;
  line-height: 1.6;
  font-size: 14px;
  margin: 0;
}

.system-description {
  margin-top: 40px;
  padding: 30px;
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  border-radius: 12px;
}

.system-description h3 {
  margin: 0 0 25px 0;
  font-size: 20px;
  font-weight: 600;
  color: #333;
  text-align: center;
}

.feature-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.feature-list li {
  margin-bottom: 15px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.3);
  color: #555;
  line-height: 1.5;
}

.feature-list li:last-child {
  border-bottom: none;
}

.feature-list strong {
  color: #333;
}



.recent-card {
  margin-top: 20px;
}
</style> 